﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;

namespace Cherry.Agile.Security
{
    /// <summary>
    /// 票据提供器的接口实现
    /// </summary>
    public interface ITokenProvider
    {
        /// <summary>
        /// 创建用户票据
        /// </summary>
        /// <param name="user"></param>
        /// <param name="createPersistent"></param>
        /// <returns></returns>
        IToken CreateToken(IIdentity user, bool createPersistent);

        /// <summary>
        /// 获取上下文中持有的票据
        /// </summary>
        /// <returns></returns>
        IToken GetCurrentToken();

        /// <summary>
        /// 清除票据
        /// </summary>
        void Clear();
    }
}
